Repository navigation
fix(control_plane): align lease recovery, settlement readback, and runtime fixtures - #9158
Conversation
…ntime fixtures Signed-off-by: LoopX Agent <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent | Gemini | Google | self_reported
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
针对 PR #9158(精确 head d4d007643f85b5a6b76a4ed17e84ced2455c4657,基线 9a377768d95c6de950acdc79aac039820b49ec51)已完成基于 capability 审查契约的独立代码审查与本地隔离验证。生产侧控制面护栏与 C1 回读修复整体严谨且与 #9157 兼容,但发现 1 个 P1 阻塞项:针对 quota_result_delivery.py 错误留证的唯一回归测试因 mock 签名缺少 record_capture 而在真正调用 original_capture 前触发 TypeError,并被宽泛异常兜底吞掉后假性通过。
动机 / Motivation
受影响的调用方包括执行 C1 控制面写回、--retry-failed-turn 恢复或 pending_closeout 结算回读的 LoopX Turn driver(turn_run_once.py)、原生管家报告恢复路径(steward_turn.py)、goal_frontier 状态归约调用方,以及开启 --record-host-poll 后遭遇落盘失败的 quota should-run CLI 调用方。
改动前:当 Turn 执行期间发生同代任务租约续租、--retry-failed-turn 恢复遇到已退役的 .validation-recovery. 或 .admission-retry 租约、待结清读取在显式传入 turn_instance_id 与 todo_id 时遇上未绑定 guard、或收据绑定重规划回溯遇上空的候选 ACK 列表时,写回会被假阴性拒绝、先导欠账 Turn 无法被点名、或 rearmed_after_obligation_id 丢失;而在 quota_result_delivery.py 中 capture 失败时也会丢掉已记录的 host_poll_receipt。改动后:上述写回围栏、pending_closeout 诊断、todo_supersede 读取与 rearm 身份传播均已恢复一致,但测试文件 tests/control_plane/test_worker_observation_recovery_cli.py 中的 failed_publication mock 因缺少 record_capture 参数在调用前抛出 TypeError,导致 quota_result_delivery.py 的 QuotaDecisionTransportError 路径实际未被该测试覆盖。
PR #9158 的 7 个生产模块变更均瞄准具体可复现的控制面恢复与 C1 回读缺口:同代租约续租、精确恢复租约绑定、todo_supersede 结清校验、todo 绑定自主重规划写回、pending_closeout 欠账点名、prior_rearm_ack 继承及 host_poll_receipt 错误载荷留存均在代码层实现;但针对 quota_result_delivery.py 失败留证的回归测试仍因 mock 签名错配而假性通过,尚未真正证明 QuotaDecisionTransportError 分支。
本 PR 不改变 GitHub CI 策略,不放宽跨 epoch、跨 key、旧无 epoch 租约、CLI 显式版本号防回退或他方认领/持有护栏,不引入新的状态词表或协议 schema,也不重做 C1 全量切换或重构既有独立生命周期模块。
为什么现在必须修好该测试缺口:如果仅保留现状合并,未来一旦 capture_decision 或 quota_result_delivery.py 在 write_decision_capture 失败前意外写入 capture_sha256 或破坏 QuotaDecisionTransportError 载荷,test_failed_capture_discloses_the_already_recorded_poll 仍会继续报错 TypeError 却绿灯通过,使该生产修复失去真实回归保护。
改动思路 / Approach
PR #9158 将问题拆解回各自的权威所有者而非在旁路叠加补丁,并在 turn_run_once.py 中与主干刚合入的 #9157(rebound_lease_active)对齐:
| 子域 | 基线缺陷 / 冲突 | PR #9158 方案(精确 head d4d007643f) |
所有权与边界 |
|---|---|---|---|
| 写回租约护栏 | Open Todo 拒绝同代 version 续租;--retry-failed-turn 遇 .validation-recovery. / .admission-retry 退役租约报错;todo_supersede 与 todo 绑定 replan guard 被拒 |
拆分 5 个辅助谓词,区分同代续租、精确恢复租约、exact-turn supersede 与受护栏约束的 replan 写回 | execution_preparation.py + turn_run_once.py + state_refresh.py |
| 结算回读 | resolveIdentity 过早返回 receipt_unbound 且 pending_closeout 关闭 nameOwedPriorTurn;未返回 supersede_event |
仅当 todoId 与 replanObligationId 均为空时提前失败;按需传递 request.turn_instance_id !== null;透传 supersede_event |
settlement_readback.ts + settlement.py |
| 重规划后重武装 | receipt_bound_replan_ack_candidates 为空时丢失前置 ACK 的 rearmed_after_obligation_id |
从最近 ACK 提取仅用于继承 rearmed_after_obligation_id 的 prior_rearm_ack,绝不设为 acknowledged=True |
goal_frontier/__init__.py(1982 行) |
| 失败传输留证 | emit_quota_result 在 capture_decision 失败前尚未记录已附加 host_poll_receipt 的决策对象 |
调用 record_capture(payload, None) 暂存决策且保持 capture_sha256=None |
quota_result_delivery.py(测试 mock 需补修) |
控制面正确性不变量保留在既有的单一权威边界内:租约与写回护栏集中于 execution_preparation.py 并通过小型具名谓词解耦复杂度;结算绑定与 pending_closeout 语义仍由 TypeScript settlement_readback.ts 统一裁决;goal_frontier/init.py 以纯衍生参数 prior_rearm_ack 补齐身份而不新增状态源;CLI 层 quota_result_delivery.py 与 turn_run_once.py 仅做参数传递与传输错误载荷保留。
当前 PR 边界限定在 release v2.4.0 控制面尾部修复与 17 个 C1/readback/navigation 测试夹具对齐;后续仅需修复 test_worker_observation_recovery_cli.py 的 failed_publication 签名与断言即可完成验证闭环,无需扩大生产改造或重构 steward_turn.py 的后缀构造。
具体改动 / Changes
规格依据与验收条目映射
依据主干既有规格 docs/architecture/rfcs/controller-executor-unified-contract-v0/contract-and-context.md(commit 3495df117229483b5104f0a68cb93034bc676de2)以及 docs/quota-allocation.md 对 pending_closeout、C1 租约证明及失败留证的要求逐条核验:
C1-LEASE-RECOVERY(implemented):hard_lease写回与恢复保留跨 epoch / 跨 key / 无 epoch / 版本回退 / 他方认领拒绝护栏,同时允许显式启用的同代续租、--retry-failed-turn恢复退役租约、todo_supersede结清与受限自主重规划写回(实现:loopx/control_plane/quota/execution_preparation.py::_hard_lease_execution_bound,验证:tests/control_plane/test_quota_execution_preparation.py与tests/test_steward_report_recovery_and_validator.py)。C1-SETTLEMENT-READBACK(implemented):pending_closeout在同一不变快照下维持对先导未结清 Turn 的命名诊断,并在includeRecords=true时暴露supersede_event(实现:loopx/control_plane/quota/settlement_readback.ts::resolveIdentity,验证:tests/control_plane_ts/quota_settlement_readback.test.ts与tests/control_plane/test_superseded_turn_settlement_cli.py)。C1-REARM-IDENTITY(implemented):在收据绑定回溯场景下保持rearmed_after_obligation_id一致性且不越权确认(实现:loopx/control_plane/goals/goal_frontier/__init__.py::build_goal_frontier_projection_context_from_status,验证:tests/control_plane/test_quota_settlement_cli.py与tests/control_plane/test_long_chain_projected_closeout.py)。C1-CAPTURE-FAILURE-RECEIPT(not_met):虽然quota_result_delivery.py本身可在真实QuotaDecisionTransportError时保留host_poll_receipt且不伪造capture_sha256,但本 PR 修改后的唯一回归测试tests/control_plane/test_worker_observation_recovery_cli.py::test_failed_capture_discloses_the_already_recorded_poll因failed_publication未接收record_capture而在调用前直接抛出TypeError,被外层异常兜底包装后假性通过,未实际证明QuotaDecisionTransportError与os.replace失败分支(最小修复:为failed_publication增加record_capture=None并透传给original_capture,同时补充"error_class" not in failed与"Decision capture failed" in failed["reason"]断言)。
关键代码讲解
-
_hard_lease_execution_bound与_recovery_lease_bound(loopx/control_plane/quota/execution_preparation.py)
将原先内联在guard_first_writeback_execution中的分支拆为职责单一的 5 个辅助函数。_clamp_admitted_lease_version仅在prepared_lease_epoch与prepared_lease_version均为纯int(排除bool)且观测版本更高时向下钳位,确保无 epoch 旧收据不能升级版本,跨 epoch(如 epoch 1 vs 2)或跨idempotency_key仍严格失败。_recovery_lease_bound只在not todo_open且存在validation_recovery_turn_instance_id时激活,要求:(a)settlement.completion_event为匹配(todo_id, agent_id, validation_recovery_turn_instance_id)的todo_complete;(b)权威存储中唯一已退役且归属当前agent_id的current_proof(来自 TSprojectExecutionPreparation)键名精确为{base}.admission-retry或以{base}.validation-recovery./{base}.admission-retry.开头;(c)requested_proof的哈希、版本经钳位后与prepared_lease完全相等。_autonomous_replan_guard_bound仅在not prepared_required and prepared_lease is None时可到达,要求semantic_replan_guard.scope == "turn_guard"、非空selected_obligation_id、heartbeat_receipt.status == "autonomous_replan_required"、delivery_allowed is not True、current.state in {"ready", "claim_required"}(若他方认领或持有租约则 TS 投影为blocked_by_conflict,直接拒绝)以及空 proof 或精确匹配的requested_proof。 -
execute_turn_run_once(loopx/cli_commands/turn_run_once.py)
针对#9157合并冲突做了正确协调:当--retry-failed-turn且非dry_run且completion_turn_key == settlement_identity.turn_instance_id时记录recovery_turn_instance_id;当且仅当completion_todo_id is not None and (recovery_turn_instance_id is None or rebound_lease_active)时才把refresh_task_lease_proof置为None。这样#9157的冻结报告重绑定路径(rebound_lease_active=True)保持原有行为,而未重绑定的--retry-failed-turn路径仍向refresh_state_run与guard_first_writeback_execution传入原始task_lease_proof与validation_recovery_turn_instance_id;同时普通 CLIrefresh-state默认保持allow_same_generation_lease_renewal=False。 -
resolveIdentity与readPendingCloseoutFromRequest(loopx/control_plane/quota/settlement_readback.ts)
在resolve_original_binding=true时,若原 Turn guard 无绑定(!originalTodoId && !originalReplanId && !requestSubject),改为仅当请求本身也未给出todoId或replanObligationId时返回"the original Turn guard has no settlement binding";否则允许流程继续进入 1137–1196 行的未绑定诊断分支,并通过readPendingCloseoutFromRequest传入request.turn_instance_id !== null启用单层owedPriorTurn查询(owedPriorTurnFromSnapshot内部仍传false,避免递归)。同时在includeRecords为真时透传supersede_event(由findStepEvent按goal_id/agent_id/run_id/settlement_effect_id精确匹配)。 -
build_goal_frontier_projection_context_from_status(loopx/control_plane/goals/goal_frontier/__init__.py)
当receipt_bound_replan_obligation_id存在且受限候选列表导致latest_agent_replan_ack为None时,回溯最近一条不等于当前receipt_bound_replan_obligation_id的 ACK 作为prior_rearm_ack。在LONG_TODO_CHAIN分支仅当原决策与prior_decision均未确认(not acknowledged)且存在rearmed_after_obligation_id时继承该字段;在VISION_ACCEPTANCE_GAP分支仅用于填充rearmed_after_obligation_id,绝不向_vision_gap_acknowledged或_succession_gap_acknowledged泄露确认状态。模块总行数控制为1982行(<= 2000)。 -
_publish_quota_result与failed_publication(loopx/cli_commands/quota_result_delivery.py&tests/control_plane/test_worker_observation_recovery_cli.py)
生产代码在attach_host_poll_receipt之后立即执行record_capture(payload, None)更新saved_decision而不写入capture_sha256。但在test_failed_capture_discloses_the_already_recorded_poll中,测试将quota_result_delivery.capture_decision替换为failed_publication(directory, payload, *, args, native_context)却遗漏了record_capture形参,导致真正调用第 367 行时直接触发TypeError而非预期的QuotaDecisionTransportError。
除上述 P1 问题外,其余 16 个测试及示例夹具文件的修改(build_goal_activation、lease_proof 显式证明、compose_turn_decision/task_context、context_capture_page_v1/context_capture_navigation_v1 分页读取、移除已退役 "legacy" provider 参数化及 --settle-turn --settlement-receipt 剥离)均与 C1 实际契约保持语义一致,未发现弱化断言或私域信息泄露。
对主干的风险 / Risks
[P1 阻塞项] test_failed_capture_discloses_the_already_recorded_poll 因 mock 签名缺少 record_capture 而触发 TypeError 假性通过
- Severity: P1(blocking)
- Trigger: 执行
tests/control_plane/test_worker_observation_recovery_cli.py::test_failed_capture_discloses_the_already_recorded_poll(loopx quota should-run --record-host-poll --decision-output-dir ...)。 - Code path:
tests/control_plane/test_worker_observation_recovery_cli.py#L220-L237->loopx/cli_commands/quota_result_delivery.py#L367-L373->loopx/cli_commands/quota_result_delivery.py#L198-L214。 - Observed outcome: 独立在精确 head
d4d007643f85b5a6b76a4ed17e84ced2455c4657探针实测显示,由于failed_publication(directory, payload, *, args, native_context)不接受record_capture=record_capture,调用瞬间抛出TypeError,original_capture与os.replace故障注入从未执行(called original_capture? False);emit_quota_result的except Exception将TypeError包装成decision_transport_failed并输出"error_class": "TypeError"与通用文案"The guard committed, but its result could not be presented.",因测试未校验error_class或reason而假性绿灯。同时这也令quota_result_delivery.py的QuotaDecisionTransportError路径缺少有效回归保护。 - Minimum repair: 在
tests/control_plane/test_worker_observation_recovery_cli.py#L220-L237为failed_publication增加record_capture=None并透传给original_capture(..., record_capture=record_capture),同时补充assert "error_class" not in failed与assert failed["reason"].startswith("Decision capture failed after guard evaluation")(已在隔离复现中验证修改后可正常触发QuotaDecisionTransportError、error_class=None并保留host_poll_receipt)。 - Rerun command:
uv run --extra test python -m pytest -q tests/control_plane/test_worker_observation_recovery_cli.py -k test_failed_capture_discloses_the_already_recorded_poll
对照分析与验证汇总
- 安全边界与权威反事实:
execution_preparation.py对外方租约/认领、跨 epoch、跨 key、无 epoch 旧收据、版本号倒退及无效恢复后缀(如turn-1.admission-retry2)均保持 fail-closed;_autonomous_replan_guard_bound在prepared_required=True或存在prepared_lease或claimed_by_other时不可达;settlement_readback.ts在无todo_id/replan_obligation_id时仍返回原receipt_unbound错误;#9157冻结报告恢复与rebound_lease_active验证全部通过。 - 本地验证实测(head
d4d007643f85b5a6b76a4ed17e84ced2455c4657):- TypeScript:
npm run typecheck:control-planePASS;node --test --experimental-strip-types覆盖quota_settlement_readback.test.ts、steward_reports.test.ts、execution_preparation.test.ts、native_child_admission.test.ts、replan_semantics.test.ts共 264 passed, 0 failed;frontier_revision.test.ts20 passed, 0 failed。并针对9a377768d9基线运行quota_settlement_readback.test.ts新增 2 用例及test_quota_execution_preparation.py新增 5 用例,独立复现基线全败、本 head 全过。 - Python:9 组核心调度与恢复套(Batch A:quota_execution_preparation / steward_report_recovery / native_steward_reports / delegation_lease_lifetime / independent_delegation_validation / recovery_due_successor_identity / worker_observation_recovery_cli / pr_wait_consumer_adoption / local_peer_delivery_journey)386 passed;13 组 C1/checkpoint/SQLite/replan 套(Batch B)410 passed, 1 skipped(唯一跳过项为
test_full_loopx_checkpoint_restore.py::test_full_restore_preserves_canonical_work_and_requires_exact_binding_cas[retained_point2],因未设置LOOPX_NATIVE_CHECKPOINT_BIN);replan/closeout/superseded/interrupted 75 passed;decision_capture 228 passed;turn_completion/recovery/complete_turn 132 passed;chat_operation_actions 43 passed;operation_original_turn/wake_preflight 24 passed;test_maintainability_ratchet.py14 passed(合计 1312 passed, 1 skipped;注:test_worker_observation_recovery_cli.py::test_failed_capture_discloses_the_already_recorded_poll的 2 个参数化用例包含在上述通过数中,但实证仅因TypeError兜底假性通过)。 - 静态与门禁:
ruff checkPASS;mypy --follow-imports=silent(20 文件)PASS;scripts/check_rfc_bilingual.pyPASS;examples/control_plane/control-plane-maintainability-ratchet-smoke.py(ok: true,unreviewed_count: 0,goal_frontier/__init__.py1982 行)与tests/canary/test_maintainability_ratchet.py(14 passed)PASS;loopx check(25 个变更文件)PASS(ok: true,hit_count: 0);loopx canary premerge --from-git-diff --git-diff-base origin/main运行结果:direct_checks4/4、python_compile1/1、risk_profile_run8/8、boundary_run1/1 全部 PASS,catalog_run9/10 通过(无node_modules符号链接时examples/semantic-vocabulary-drift-smoke.py因缺少typescript依赖报错;挂载 TS 依赖复测该脚本返回semantic-vocabulary-drift-smoke: okexit=0);作者 CQR 收据cqr_1315f4b55cdb5dd5d5c4只读核验status=valid, receipt_valid=true(25 个文件一致)。 - 非阻塞观察:
execution_preparation.py#L335对requested_proof["expected_version"]使用isinstance(..., int)而未排除bool(可作轻量一致化 follow-up);.validation-recovery./.admission-retry键格式在steward_turn.py与execution_preparation.py仍有共享辅助函数的整理空间,均不构成阻塞。
- TypeScript:
我的整体评价 / Verdict
- 长程与用户体验影响:在
long_horizon维度,租约同代续租、恢复绑定、todo_supersede结清、pending_closeout诊断与rearmed_after_obligation_id继承均保持(preserved)既有长程推进与幂等恢复语义;在user_experience维度,因quota_result_delivery.py的QuotaDecisionTransportErrorhost_poll_receipt保留路径在测试中被TypeErrormock 掩盖,属于未充分证明(not_yet_proven)。visual_review为not_applicable:本次改动仅涉及 loopx/control_plane/、loopx/cli_commands/、loopx/state_refresh.py、examples/ 与 tests/ 中的控制面逻辑与 CLI/测试夹具,未修改任何前端页面、桌面端视图或渲染组件(checked all 25 changed paths)。;未验证范围:none(纯控制面与 CLI 改动,无前端渲染范围)。 - 代码体量与相称性:生产净变更集中且结构克制,拆分
guard_first_writeback_execution显著降低了单函数圈复杂度且守住goal_frontier/__init__.py<= 2000行红线;code_volume结论为necessary(兼容边界评估retain,保留无 epoch 旧收据精确版本语义),change_proportionality结论为proportionate,architecture_assessment决定为retain(边界见上文“改动思路”)。 - 语义词表与发布边界:本 PR 未新增或修改任何
Enum/Literal/as const封闭词表,全部复用既有状态与收据字段(reuse_existing);diff 扫描未发现本地绝对路径、凭证或私域信息。待修复test_worker_observation_recovery_cli.py中failed_publication的record_capture参数透传与QuotaDecisionTransportError断言后,即可重新提交复审并进入合并流程。
English verdict: REQUEST_CHANGES on 9158@d4d007643f85b5a6b76a4ed17e84ced2455c4657 — Fix the broken failed_publication mock signature (record_capture=None) and assert real QuotaDecisionTransportError delivery without error_class in tests/control_plane/test_worker_observation_recovery_cli.py; all production fixes and other verified suites passed local validation.
…harden version type guard Signed-off-by: LoopX Agent <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent | Gemini | Google | self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
针对 PR #9158 的 Round 2 精确 head 0bf00a7da6506454abdcb1016d91b101690fbaac(基于 Round 1 d4d007643f85b5a6b76a4ed17e84ced2455c4657 追加修复;PR base 9a377768d95c6de950acdc79aac039820b49ec51,远端 origin/main 已推进至 ddba6bf3964baa59e0d86979119aa027422d2aa5 且与本 PR 25 个文件零重叠)已完成独立代码审计与隔离验证。Round 1 指出的 P1(failed_publication mock 缺少 record_capture 透传导致 TypeError 假性通过)与 P3(expected_version 未排除 bool)已全部修复并通过实测,当前无阻塞问题。
动机 / Motivation
受影响的调用方包括执行 C1 控制面写回、--retry-failed-turn 恢复或 pending_closeout 结算回读的 LoopX Turn driver(turn_run_once.py)、原生管家报告恢复路径(steward_turn.py)、goal_frontier 状态归约调用方,以及开启 --record-host-poll 后遭遇落盘失败的 quota should-run CLI 调用方。
改动前:当 Turn 执行期间发生同代任务租约续租、--retry-failed-turn 恢复遇到已退役的 .validation-recovery. 或 .admission-retry 租约、待结清读取在显式传入 turn_instance_id 与 todo_id 时遇上未绑定 guard、收据绑定重规划回溯遇上空的候选 ACK 列表、或 quota_result_delivery.py 中 capture 失败时,写回会被假阴性拒绝、先导欠账 Turn 无法点名、rearmed_after_obligation_id 丢失,或已记录的 host_poll_receipt 被丢弃;且 Round 1(commit d4d0076)中 test_failed_capture_discloses_the_already_recorded_poll 的 mock 漏接 record_capture 导致 TypeError 假性通过。改动后(commit 0bf00a7):上述生产护栏与回读逻辑全部到位,Round 1 的 P1 测试 mock 已补齐 record_capture=None 透传、replace_calls == 1 与无 error_class 的真实 QuotaDecisionTransportError 断言,Round 1 的 P3 bool 防护也已补充。
Round 2 在精确 head 0bf00a7 上验证:同代租约续租(显式 bool 排除)、精确恢复租约绑定、todo_supersede 结清校验、todo 绑定自主重规划写回、pending_closeout 欠账点名、prior_rearm_ack 继承以及 capture 失败时保留 host_poll_receipt 且不设 capture_sha256 均已由独立 TypeScript、Python 回归测试与静态门禁实测通过。
本 PR 不改变 GitHub CI 策略,不放宽跨 epoch、跨 key、旧无 epoch 租约、CLI 显式版本号防回退或他方认领/持有护栏,不引入新的状态词表或协议 schema,也不覆盖并行独立分支(如 Slice B4/B5)或重做 C1 全量切换。
本 PR(Slice B3)聚焦 release v2.4.0 控制面尾部修复与 17 个 C1/readback/navigation 测试夹具对齐;其余独立并行收尾分支与全仓非变更面全量回归由对应分支与发布候选统一验收,主干基线推进至 ddba6bf 与本 PR 的 25 个变更文件零重叠。
改动思路 / Approach
PR #9158 将各子域缺陷收口至既有权威所有者,并在 turn_run_once.py 中保持与 #9157(rebound_lease_active)兼容;Round 2 针对 Round 1 反馈做了最小精准闭环:
| 子域 | 基线 / Round 1 缺口 | PR #9158 Round 2 方案(精确 head 0bf00a7da6) |
所有权与边界 |
|---|---|---|---|
| 写回租约护栏 | Open 同代续租/恢复后缀/todo_supersede/replan guard 假拒;R1 expected_version 未排除 bool |
拆分为 5 个谓词并在 execution_preparation.py#L334-L337 显式排除 bool |
execution_preparation.py + turn_run_once.py + state_refresh.py |
| 结算回读 | resolveIdentity 过早失败且 pending_closeout 未启用 nameOwedPriorTurn;缺 supersede_event |
显式传入 todoId/replanObligationId 进入诊断;按 turn_instance_id !== null 启用单层查询并暴露 supersede_event |
settlement_readback.ts + settlement.py |
| 重规划后重武装 | 候选 ACK 列表为空时丢失 rearmed_after_obligation_id |
从最近非当前 obligation ACK 提取 prior_rearm_ack 且绝不传播 acknowledged=True |
goal_frontier/__init__.py(1982 行) |
| 失败传输留证 | R1 failed_publication 漏收 record_capture 触发 TypeError 掩盖 QuotaDecisionTransportError |
record_capture(payload, None) 暂存 host_poll_receipt;测试透传 record_capture 并断言 replace_calls == 1 且无 error_class |
quota_result_delivery.py + test_worker_observation_recovery_cli.py |
控制面正确性不变量保留在既有的单一权威边界内:租约与写回护栏集中于 execution_preparation.py 并通过小型具名谓词解耦复杂度;结算绑定与 pending_closeout 语义仍由 TypeScript settlement_readback.ts 统一裁决;goal_frontier/init.py 以纯衍生参数 prior_rearm_ack 补齐身份而不新增状态源;CLI 层 quota_result_delivery.py 与 turn_run_once.py 仅做参数传递与传输错误载荷保留。
当前 PR 边界限定在 release v2.4.0 控制面尾部修复与 17 个 C1/readback/navigation 测试夹具对齐,Round 2 仅追加 test_worker_observation_recovery_cli.py mock 修复与 execution_preparation.py expected_version bool 排除,未越界修改无关模块或扩大生产重构。
具体改动 / Changes
规格依据与验收条目映射
依据主干既有规格 docs/architecture/rfcs/controller-executor-unified-contract-v0/contract-and-context.md(commit 3495df117229483b5104f0a68cb93034bc676de2)以及 docs/quota-allocation.md 对 pending_closeout、C1 租约证明及失败留证的要求逐条核验:
C1-LEASE-RECOVERY(implemented):hard_lease写回与恢复保留跨 epoch / 跨 key / 无 epoch / 版本回退 / 他方认领与布尔版本拒绝护栏,同时允许显式启用的同代续租、--retry-failed-turn恢复退役租约、todo_supersede结清与受限自主重规划写回(实现:loopx/control_plane/quota/execution_preparation.py::_hard_lease_execution_bound,验证:tests/control_plane/test_quota_execution_preparation.py与tests/test_steward_report_recovery_and_validator.py)。C1-SETTLEMENT-READBACK(implemented):pending_closeout在同一不变快照下维持对先导未结清 Turn 的命名诊断,并在includeRecords=true时暴露supersede_event(实现:loopx/control_plane/quota/settlement_readback.ts::resolveIdentity,验证:tests/control_plane_ts/quota_settlement_readback.test.ts与tests/control_plane/test_superseded_turn_settlement_cli.py)。C1-REARM-IDENTITY(implemented):在收据绑定回溯场景下保持rearmed_after_obligation_id一致性且不越权确认(实现:loopx/control_plane/goals/goal_frontier/__init__.py::build_goal_frontier_projection_context_from_status,验证:tests/control_plane/test_quota_settlement_cli.py与tests/control_plane/test_long_chain_projected_closeout.py)。C1-CAPTURE-FAILURE-RECEIPT(implemented):quota_result_delivery.py在真实QuotaDecisionTransportError时保留host_poll_receipt且不伪造capture_sha256;Round 2 在tests/control_plane/test_worker_observation_recovery_cli.py#L220-L246中为failed_publication透传record_capture=None,通过replace_calls == 1、"error_class" not in failed与"Decision capture failed" in failed["reason"]在 File 与 SQLite 双后端实测闭环。
Round 2 增量变更审计(d4d007643f..0bf00a7da6)
failed_publication真实故障注入闭环(tests/control_plane/test_worker_observation_recovery_cli.py#L220-L253)
新增replace_calls = 0计数器与record_capture=None形参,将record_capture=record_capture透传给original_capture并在finally累计mocked_replace.call_count;随后断言replace_calls == 1、code == 1、failed["status"] == "decision_transport_failed"、"error_class" not in failed、"Decision capture failed" in failed["reason"]以及"captured_decision" not in failed且保留完整host_poll_receipt。expected_version布尔类型防护(loopx/control_plane/quota/execution_preparation.py#L332-L339)
在同代续租分支对current_proof.get("expected_version")与requested_proof.get("expected_version")均追加and not isinstance(..., bool),消除 Pythonisinstance(True, int) is True的隐式隐患,与其他版本/epoch 类型判断保持一致。- 主干基线对齐复核(
9a377768d9..ddba6bf396)
经comm -12比对,远端origin/main推进期间修改的文件集合与本 PR 修改的 25 个文件无任何交集;作者本地 Goal CQR 收据cqr_a07db66b42e564ec382b(范围指纹a07db66b42e564ec382b71bd3633e138809fc5465d121118d8bf9cc84e4bb93c,25 文件)只读核验为status: valid, receipt_valid: true。
对主干的风险 / Risks
- 安全边界与主干兼容性:
execution_preparation.py对外方租约/认领、跨 epoch、跨 key、无 epoch 旧收据、布尔/倒退版本及无效恢复后缀均保持 fail-closed;_autonomous_replan_guard_bound在prepared_required=True、prepared_lease存在或claimed_by_other时不可达;#9157冻结报告恢复与rebound_lease_active逻辑完好。 - Round 2 本地隔离实测(head
0bf00a7da6506454abdcb1016d91b101690fbaac):- TypeScript:
npm run typecheck:control-planePASS;node --no-warnings --test --experimental-strip-types覆盖quota_settlement_readback.test.ts、steward_reports.test.ts、execution_preparation.test.ts、native_child_admission.test.ts、replan_semantics.test.ts与frontier_revision.test.ts共 284 passed, 0 failed。 - Python:Round 2 针对受影响核心套(
test_worker_observation_recovery_cli.py、test_quota_execution_preparation.py、test_native_steward_reports.py、test_steward_report_recovery_and_validator.py)全量实测 289 passed, 0 failed(0skipped);其中test_failed_capture_discloses_the_already_recorded_poll(file/sqlite 双后端)真实穿过original_capture与os.replace故障注入(replace_calls == 1、无error_class、含Decision capture failed原因且保留host_poll_receipt)。另结合 Round 1 审计对未改动测试面(Batch A/B 其余套、decision_capture、turn_completion、chat_operation、ratchet)的基线覆盖(该 2 处以外 23 个文件及核心逻辑在 Round 2 均未变更),全系列相关回归均已完成核验。 - 静态与门禁:
ruff check(23 个变更.py文件)PASS;mypy --follow-imports=silent(配置 20 个源文件)Success: no issues found in 20 source files;scripts/check_rfc_bilingual.pyPASS;examples/control_plane/control-plane-maintainability-ratchet-smoke.py --format=jsonPASS(ok: true,unreviewed_count: 0,goal_frontier/__init__.py1982行<= 2000);examples/semantic-vocabulary-drift-smoke.py(挂载 TSnode_modules)PASS(semantic-vocabulary-drift-smoke: okexit 0);loopx check(25 个变更文件)PASS(ok: true,public boundary scan clean: 25 files);loopx canary premerge --from-git-diff --git-diff-base origin/main(无node_modules符号链接隔离工作树):direct_checks6/6、risk_profile_run8/8、boundary_run1/1 全部 PASS,catalog_run9/10 通过(唯一失败项为无node_modules时semantic-vocabulary-drift-smoke.py报NPM_DEV_DEPENDENCIES_MISSING,已挂载依赖独立复测通过;隔离工作树change_quality为null);作者 Goal CQR 收据cqr_a07db66b42e564ec382b只读核验status=valid, receipt_valid=true(25 个文件一致)。
- TypeScript:
- 残余风险(Non-blocking):
- 与本 PR 无交集的仓库全量其余测试套件留待对应收尾分支与发布候选统一验证。
.validation-recovery./.admission-retry键格式在steward_turn.py与execution_preparation.py后续可提取共享辅助函数(非本次阻塞)。
我的整体评价 / Verdict
- 长程与用户体验影响:在
long_horizon维度,租约同代续租(含bool排除)、恢复绑定、todo_supersede结清、pending_closeout诊断与rearmed_after_obligation_id继承均保持(preserved)既有长程推进与幂等恢复语义;在user_experience维度,quota_result_delivery.py的QuotaDecisionTransportErrorhost_poll_receipt保留路径已在 File 与 SQLite 双后端通过真实os.replace故障注入与无error_class断言验证(preserved)。visual_review为not_applicable:本次改动仅涉及 loopx/control_plane/、loopx/cli_commands/、loopx/state_refresh.py、examples/ 与 tests/ 中的控制面逻辑与 CLI/测试夹具,未修改任何前端页面、桌面端视图或渲染组件(checked all 25 changed paths)。 未验证范围:none(纯控制面与 CLI 改动,无前端渲染范围)。 - 代码体量与相称性:Round 2 仅改动 2 个文件共
+14/-4行,精准消除 P1/P3 缺口;全 PR 25 个文件净变更克制,拆分guard_first_writeback_execution降低圈复杂度并保持goal_frontier/__init__.py为1982 <= 2000行;code_volume为necessary(兼容边界评估retain),change_proportionality为proportionate,architecture_assessment为retain(边界见上文“改动思路”)。 - 语义词表与发布边界:本 PR 未新增或修改任何
Enum/Literal/as const封闭词表(reuse_existing);全 diff 与远端回读均无本地绝对路径、凭证或私域信息泄露,满足精确 head 批准条件(wait_for_ci: false)。
English verdict: APPROVE on 9158@0bf00a7da6506454abdcb1016d91b101690fbaac — Round 2 resolved the Round 1 P1 mock signature gap (record_capture forwarding and replace_calls == 1 / QuotaDecisionTransportError assertions without error_class) and P3 bool guard; TypeScript checks, targeted Python suites, static checks, and public-boundary gates all passed cleanly.
Signed-off-by: LoopX Agent <[email protected]>
…wording (#9162) * docs(release): reconcile final v2.4.0 stabilization PRs and boundary wording Signed-off-by: LoopX Agent <[email protected]> * docs(release): align #9158 and #9161 descriptions with verified commits Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]>
* fix(cli): preserve typed runtime diagnostics in Turn failures Signed-off-by: LoopX Agent <[email protected]> * feat(steward): support per-endpoint model preferences and Codex-to-Antigravity failover (#9141) Signed-off-by: LoopX Agent <[email protected]> * Keep the prepared Chat adapter available to a retry (#9134) A failed worker start can finish cleanup after a same-turn retry has selected the adapter. Keep its lifetime tied to the Session and let failed dispatch release its own worker registration. The regression asserts one upstream turn and explicit adapter closure with the Session. Port the fix from 4453e4bdd77486ec14b952f88ca893310b32e26c. (cherry picked from commit 173e42b4f051b885c3a3389e1cad9c5722f7b7dd) Signed-off-by: LoopX Agent <[email protected]> * fix(steward): recover zero-effect monitors and cleared-replan reports (#9143) Signed-off-by: LoopX Agent <[email protected]> * fix(steward): admit flexible_primary_available executor transitions in conversation_scope (#9145) Signed-off-by: LoopX Agent <[email protected]> * Verify quota gate scope through signed lane references (#9101) * test(quota): verify scoped gates through complete lane references Signed-off-by: LoopX Agent <[email protected]> * Test canonical quota gates in both public response modes Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * Test C1 planning and Host input from the original quota capture (#9102) * Use recorded quota decisions in the no-Todo settlement regression Signed-off-by: LoopX Agent <[email protected]> * Exercise the complete Host prompt from the captured quota source Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * Prepare the CLI budget baseline with a private Git index (#9103) Signed-off-by: LoopX Agent <[email protected]> * Exercise C1 Goal delivery and bound replan from the saved source (#9104) Signed-off-by: LoopX Agent <[email protected]> * Keep long claim overlap scopes on demand (#9086) * Link long thin-claim overlap lists to their receipts Signed-off-by: LoopX Agent <[email protected]> * Read claim overlap details without copying the lease Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(quota): preserve explicit Monitor Todo selection (#9099) Carry Todo selection provenance into quota admission. Preserve explicit secondary Monitor polling and recovery from previously admitted receipts. Signed-off-by: LoopX Agent <[email protected]> * Keep ready Todo scope details on the required context read (#9106) Signed-off-by: LoopX Agent <[email protected]> * Fix archive rollback with custom install directories (#9066) * refactor(core): defer benchmark implementations during capability discovery Preserve the benchmark toolkit public exports and static types while keeping execution and experiment implementations out of metadata discovery. Qualify source and installed Core paths, and reconcile the paired minimal/Standard RFC boundary without changing activation or authority defaults. Signed-off-by: cicolord <[email protected]> * Defer Yardstick evaluation until an enabled Explore read Signed-off-by: cicolord <[email protected]> * Omit empty Todo summary lanes from ordinary Worker context Signed-off-by: cicolord <[email protected]> * fix(update): honor configured archive directories during rollback Signed-off-by: LoopX Agent <[email protected]> * fix(lark): replay recall guard on current main Signed-off-by: huangruiteng <[email protected]> * docs: record the verified LoopX 2.3.0 release baseline Signed-off-by: LoopX Agent <[email protected]> * Preserve quota spend source when prepared work is admitted Signed-off-by: LoopX Agent <[email protected]> * test(quota): qualify native saved complete-Turn checkpoints Signed-off-by: LoopX Agent <[email protected]> * Retry cleanup of an owned file mutation marker Signed-off-by: LoopX Agent <[email protected]> * Keep synthetic Git-path test data outside the public source scan Signed-off-by: LoopX Agent <[email protected]> * fix(quota): share native preparation wait with readiness Signed-off-by: LoopX Agent <[email protected]> * fix(doctor): bind package update readback to its Python environment Signed-off-by: LoopX Agent <[email protected]> * Keep Doctor discovery separate from service activation Signed-off-by: LoopX Agent <[email protected]> * Verify the recorded Python launcher before Doctor probes it Signed-off-by: LoopX Agent <[email protected]> * fix(desktop): require runtime qualification for macOS preview updates Signed-off-by: LoopX Agent <[email protected]> * fix(quota): reuse replan projection owners during recovery Signed-off-by: LoopX Agent <[email protected]> * Qualify Codex 0.169 native context replay on main Signed-off-by: LoopX Agent <[email protected]> * Stop regenerating retired quota view aliases Signed-off-by: LoopX Agent <[email protected]> * fix: pin deferred native context reads to the original capture Signed-off-by: LoopX Agent <[email protected]> * Keep native capture navigation within small output budgets Signed-off-by: LoopX Agent <[email protected]> * Retire legacy heartbeat work prompt generation Signed-off-by: LoopX Agent <[email protected]> * Capture C1 composition failures as receipt diagnostics Signed-off-by: LoopX Agent <[email protected]> * Recover interrupted native Todo readiness from the original Turn Signed-off-by: LoopX Agent <[email protected]> * Revalidate the original lease before publishing resumed native context Signed-off-by: LoopX Agent <[email protected]> * Fence native readiness publication with the canonical lease writer Signed-off-by: LoopX Agent <[email protected]> * fix(scheduler): keep Codex fallback on the original C1 runtime Signed-off-by: LoopX Agent <[email protected]> * fix(scheduler): pin the originating fallback launchers Signed-off-by: LoopX Agent <[email protected]> * Retire the duplicate Codex App scheduler projection Signed-off-by: LoopX Agent <[email protected]> * Seed the recorded scheduler profile in the elapsed-backoff fixture Signed-off-by: LoopX Agent <[email protected]> * Verify canonical cadence on refused and settled Turns Signed-off-by: LoopX Agent <[email protected]> * Pin named Core commands in saved scheduler fallbacks Signed-off-by: LoopX Agent <[email protected]> * fix(research): preserve saved case addresses when a version cannot open Signed-off-by: LoopX Agent <[email protected]> * Preserve citation focus after a saved study refresh Signed-off-by: LoopX Agent <[email protected]> * Capture authenticated LoopX receipts for Research attention (#8790) * feat(research): capture authenticated LoopX attention receipts Signed-off-by: lusendong.6789 <[email protected]> Co-authored-by: TRAE CLI <[email protected]> * fix(research): tighten attention receipt provenance Signed-off-by: lusendong.6789 <[email protected]> Co-authored-by: TRAE CLI <[email protected]> * fix(research): publish attention captures after source validation Signed-off-by: huangruiteng <[email protected]> --------- Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: huangruiteng <[email protected]> Co-authored-by: TRAE CLI <[email protected]> Co-authored-by: huangruiteng <[email protected]> * Recover the original Session and Turn from a confirmed Chat task Signed-off-by: huangruiteng <[email protected]> * perf(lark,native_chat): eliminate redundant full-directory JSON reparsing in steward chat loops (#9041) * perf(lark,native_chat): avoid full directory reparsing in steward chat loops - Make LarkOwnerAttention._route iterate capture candidates lazily so matching stops at the newest valid p2p capture. - Reuse FileChatDiscovery in PrivateIngressObserver._records while preserving strict field validation and fail-closed errors. - Reuse FileChatDiscovery in ChatExternalConversations.pending so unchanged request journals skip redundant JSON reads and stay mutation-isolated. - Add regression and scan-efficiency tests in tests/test_lark_steward_directory_scan_perf.py. Signed-off-by: LoopX Agent <[email protected]> * fix(native-chat): project small recovery metadata fields to stop data_url memory growth Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * Retire transitional smoke checks and duplicate execution (#9073) Signed-off-by: lusendong.6789 <[email protected]> Co-authored-by: TRAE CLI <[email protected]> * feat(steward): support probe-gated generic continuous_monitor todos with handoff and user actions (#9074) Signed-off-by: LoopX Agent <[email protected]> * Remove redundant defensive prose from prompts and comments (#9072) Remove redundant defensive prose while preserving published heartbeat wrappers and externally managed skill readiness. Validated with 197 related tests, independent historical wrapper migrations and negative cases, installed-skill readback, and current-main quick canary. Existing CI qualification and infrastructure limitations remain recorded in PR #9072. Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: Lusen Dong <[email protected]> * Keep original Chat retry errors visible during receipt refresh Signed-off-by: LoopX Agent <[email protected]> * fix(steward): tolerate report validator python drift and allow cancel of mid-turn failed reports (#9077) Signed-off-by: LoopX Agent <[email protected]> * feat(steward): add exact-head PR review signals and protected merge confirmation (#9081) Signed-off-by: LoopX Agent <[email protected]> * feat(steward): add isolated OpenViking long-term memory with per-speaker boundaries (#9083) Signed-off-by: LoopX Agent <[email protected]> * refactor(content-ops): slim surface module and eliminate Any (#8961) * refactor(content-ops): slim surface module and eliminate Any Signed-off-by: LoopX Agent <[email protected]> * fix(content-ops): reject malformed angle source_item_ids containers Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(collaboration): batch handoff query Goal lifetime guard lock per Goal (#9085) Signed-off-by: LoopX Agent <[email protected]> * fix(hosts): raise managed service startup readiness timeout to 45s (#9087) Signed-off-by: LoopX Agent <[email protected]> * perf(manager-context): memoize history_inspect lifecycle checks and scope runtime revision in handoffs query (#9088) Eliminate the remaining O(N) Effect runtime RPCs and uncached runtime fingerprinting inside tracking.query(): enter effect_runtime_request_scope() for the query, memoize pure history_inspect lifecycle decisions across entries sharing identical Goal refs while holding the Goal lifetime guard, lazily discover legacy ingress files only when external audience recovery needs them, and preserve entry scan order across Goal batches. Signed-off-by: LoopX Agent <[email protected]> * refactor(lark): slim private_conversations below 2000 lines with net LOC reduction (#8929) Signed-off-by: LoopX Agent <[email protected]> * perf(chat,hosts): skip frontend source re-hashing on immutable installed releases and extend readiness timeout to 90s (#9089) Signed-off-by: LoopX Agent <[email protected]> * refactor(control-plane): split and slim quota monitor_poll_commit (#8885) * refactor(control-plane): split and slim quota monitor_poll_commit Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): preserve legacy lane budget and observation diagnostic order Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * refactor(quota): slim loopx/quota.py and tighten Any count to zero (#8939) Signed-off-by: LoopX Agent <[email protected]> * refactor(native-chat): slim external_conversations below 2k lines and retire ceiling (#8911) * refactor(native-chat): move steward commission mixin to steward_commands and retire external_conversations ceiling Signed-off-by: LoopX Agent <[email protected]> * fix(native-chat): respect include_raw_response in retained result recovery Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * refactor(chat): slim chat_runtime below 1,500 lines, fix entry-point project_contexts guard, and retire ceiling (#8920) * refactor(chat): move session lifecycle mixin to session_open, deduplicate runtime helpers, and retire ceiling Signed-off-by: LoopX Agent <[email protected]> * fix(chat): drop turn_done_events slot before waking waiters on Thread.start failure Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(steward): paginate open PR signal GraphQL, allow signal-unavailable monitor recovery, and cache private delivery scans (#9093) Signed-off-by: LoopX Agent <[email protected]> * perf(lark,native_chat): back off noop recovery retries and cache recovery lookups (#9096) Signed-off-by: LoopX Agent <[email protected]> * perf(native_chat,lark): cache unchanged quota backlog health and interrupt observations (#9098) Signed-off-by: LoopX Agent <[email protected]> * perf(lark,native_chat): coalesce listener snapshots and cache recovery event summaries (#9100) Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: cicolord <[email protected]> Signed-off-by: LoopX Agent <[email protected]> Signed-off-by: huangruiteng <[email protected]> Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: Lusen Dong <[email protected]> Co-authored-by: cicolord <[email protected]> Co-authored-by: huangruiteng <[email protected]> Co-authored-by: Lusen Dong <[email protected]> Co-authored-by: TRAE CLI <[email protected]> * refactor(issue-fix): consolidate maintainer-correction admission and slim pr_lifecycle (#8897) Signed-off-by: LoopX Agent <[email protected]> * Fix truncated requests and responses in the Codex API relay (#8713) * fix(codex relay): fence incomplete model requests before drain Signed-off-by: LoopX Agent <[email protected]> * fix(codex relay): surface incomplete upstream responses Port the verified response framing fix to the request-admission branch. Original candidate 27bc3aee311cdfc6a00466ff9d3b58c7db36e01b. Signed-off-by: LoopX Agent <[email protected]> * Bound Codex relay writes to clients that stop reading Signed-off-by: LoopX Agent <[email protected]> * Reject upstream chunked responses missing the trailer terminator Signed-off-by: LoopX Agent <[email protected]> * Validate upstream chunk data delimiters before relay completion Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(release): repair dsh closeout test, antigravity failover alias, and release download retry (#9147) Signed-off-by: LoopX Agent <[email protected]> * docs(release): update v2.4.0 release notes and dsh-loopx-plugin 0.1.1-beta.7 README (#9149) Signed-off-by: LoopX Agent <[email protected]> * fix(chat): recover saved answers and diagnose lost workers (#9120) * fix(chat): recover saved answers and diagnose lost workers Signed-off-by: LoopX Agent <[email protected]> * style(lark): keep private_conversations within module line budget Signed-off-by: LoopX Agent <[email protected]> * fix(chat): retain execution_worker_exited in pending backlog count Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(chat): resume steward requests lost before dispatch (#9125) Signed-off-by: LoopX Agent <[email protected]> * fix(benchmark): restore frozen v1 archives and align checkpoint/runtime tests with C1 defaults (#9151) Signed-off-by: LoopX Agent <[email protected]> * fix(release): stabilize CLI help, architecture guards, onboarding gate, and public smokes (#9152) Signed-off-by: LoopX Agent <[email protected]> * fix(steward): recover report selection across python upgrades and prevent queue kill on observation monitors (#9155) Signed-off-by: LoopX Agent <[email protected]> * fix(release): align extensions, chat, presentation, and transport tests for v2.4.0 (#9156) Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): stabilize v2.4.0 quota, turn-envelope, and capabilities slice (Slice B1) (#9154) * fix(control-plane): stabilize v2.4.0 quota, turn-envelope, and capabilities slice Signed-off-by: LoopX Agent <[email protected]> * fix(quota): preserve tokenless identity and exact numeric types in attach_complete_turn_context Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(steward): recover frozen report contract failures and rebind resumed task leases (#9157) Signed-off-by: LoopX Agent <[email protected]> * fix(steward): recover pre-dispatch runtime failures across endpoints and stop receipt-unknown disk churn (#9159) Signed-off-by: LoopX Agent <[email protected]> * fix(control_plane): align lease recovery, settlement readback, and runtime fixtures (#9158) * fix(control_plane): align lease recovery, settlement readback, and runtime fixtures Signed-off-by: LoopX Agent <[email protected]> * fix(control_plane): forward record_capture in worker outage test and harden version type guard Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): stabilize v2.4.0 explore, context, and checkpoint tail slice (Slice B4) (#9161) Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): stabilize v2.4.0 replan, monitor recovery, and staged-read slice (Slice B5) (#9160) Signed-off-by: LoopX Agent <[email protected]> * docs(release): reconcile final v2.4.0 stabilization PRs and boundary wording (#9162) * docs(release): reconcile final v2.4.0 stabilization PRs and boundary wording Signed-off-by: LoopX Agent <[email protected]> * docs(release): align #9158 and #9161 descriptions with verified commits Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> * fix(steward): tolerate minor JSON delimiter glitches and recover saved report candidates (#9164) Signed-off-by: LoopX Agent <[email protected]> * fix(control-plane): preserve bound yardstick reversals in native replan openings (#9165) Signed-off-by: LoopX Agent <[email protected]> * fix(native-chat): recover loopback relay 401 failures and isolate test auth (#9167) Signed-off-by: LoopX Agent <[email protected]> --------- Signed-off-by: LoopX Agent <[email protected]> Signed-off-by: cicolord <[email protected]> Signed-off-by: huangruiteng <[email protected]> Signed-off-by: lusendong.6789 <[email protected]> Signed-off-by: Lusen Dong <[email protected]> Co-authored-by: cicolord <[email protected]> Co-authored-by: huangruiteng <[email protected]> Co-authored-by: Lusen Dong <[email protected]> Co-authored-by: TRAE CLI <[email protected]>
Summary
Pre-release
v2.4.0control-plane stabilization (Lease / Recovery / Authority slice, rebased cleanly ontoorigin/main9a377768d9/#9157):Task-lease writeback & recovery fences (
execution_preparation.py,state_refresh.py,turn_run_once.py)lease_epochpinned, matchingidempotency_key, non-regressing version) active lease renewals duringguard_first_writeback_executionwhenallow_same_generation_lease_renewal=True, without relaxing cross-epoch, cross-key, legacy no-epoch, CLI explicit-proof, or version-regression checks.--retry-failed-turnrecovery against retired.validation-recovery.<version>and.admission-retry[.<turn_id>]leases bound to the exact(todo_id, agent_id, turn_instance_id)todo_completereceipt (reconciled cleanly with#9157's rebound lease handling inturn_run_once.py).todo_supersedecloseout receipts (supersede_event) and todo-boundautonomous_replan_requiredsemantic writebacks (prepared_leaseabsent) without weakening foreign-owner or mismatched-proof checks.guard_first_writeback_executioninto focused helpers (_clamp_admitted_lease_version,_recovery_lease_bound,_autonomous_replan_guard_bound,_hard_lease_execution_bound,_todo_superseded_for_turn) to stay within control-plane maintainability budgets.Settlement readback & goal-frontier rearm preservation (
settlement_readback.ts,settlement.py,goal_frontier/__init__.py,quota_result_delivery.py)settlement_readback.ts, only fail"the original Turn guard has no settlement binding"when bothtodo_idandreplan_obligation_idare null, passnameOwedPriorTurn(turn_instance_id !== null) forpending_closeout, and exposesupersede_eventwhenincludeRecords=true.goal_frontier/__init__.py, preserverearmed_after_obligation_idviaprior_rearm_ackwhen receipt-bound replan ACK history overrideslatest_agent_replan_ack(keeping module lines at 1982 <= 2000).quota_result_delivery.py, persisthost_poll_receiptonQuotaDecisionTransportErrorfailure payloads without prematurely recording acapture_sha256.Test & fixture alignment across 20 Slice B3 modules + regressions
examples/operation_action_fixtures.py(build_goal_activation), C1 lease proof / guard updates,#9004single-step settlement plan andloopx_turn_model_context_v0lookup updates, removed"legacy"provider case (["file", "sqlite"]), andcontext_capture_page_v1/context_capture_navigation_v1paged readback helpers.tests/control_plane/test_quota_execution_preparation.py) and TypeScript (tests/control_plane_ts/quota_settlement_readback.test.ts) unit tests covering same-generation renewals,.validation-recovery./.admission-retrymatching and rejections,supersede_event, autonomous replan guards, andpending_closeoutowed-prior-Turn naming.Verification
All checks ran locally after the final commit
d4d007643f:864 passed, 1 pre-existing skip in test_full_loopx_checkpoint_restore.py, 0 failed) across all 22 assigned Slice B3 modules plustest_quota_execution_preparation.py,test_steward_report_recovery_and_validator.py(#9157),test_autonomous_replan_ack.py, andtest_quota_settlement_cli.py:tests/test_native_steward_reports.py(162 passed)tests/test_delegation_lease_lifetime.py,tests/test_independent_delegation_validation.py,tests/control_plane/test_deferred_resume_generated_command.py,tests/control_plane/test_issue_fix_private_evidence_settlement.py,tests/control_plane/test_local_peer_delivery_journey.py,tests/control_plane/test_research_context_adoption.py,tests/control_plane/test_sqlite_authority_cli.py(123 passed)tests/control_plane/test_recovery_due_successor_identity.py,tests/control_plane/test_superseded_turn_settlement_cli.py,tests/control_plane/test_full_loopx_checkpoint_restore.py,tests/control_plane/test_checkpoint_restore_capture.py,tests/control_plane/test_interrupted_turn_continuation.py,tests/control_plane/test_long_chain_projected_closeout.py,tests/control_plane/test_operation_requests.py,tests/control_plane/test_sqlite_archive_and_registry_health.py,tests/control_plane/test_quota_execution_preparation.py,tests/test_steward_report_recovery_and_validator.py(224 passed, 1 skipped)tests/control_plane/test_cli_source_activation_readback.py,tests/control_plane/test_delegation_source_replay.py,tests/control_plane/test_effect_runtime_host_permission.py,tests/control_plane/test_effect_runtime_request_scope.py,tests/control_plane/test_worker_observation_recovery_cli.py,tests/control_plane/test_pr_wait_consumer_adoption.py,tests/control_plane/test_autonomous_replan_ack.py,tests/control_plane/test_quota_settlement_cli.py(355 passed)npm run typecheck:control-plane: passednode --no-warnings --experimental-strip-types --testonquota_settlement_readback.test.ts,steward_reports.test.ts,native_child_admission.test.ts,replan_semantics.test.ts,execution_preparation.test.ts:264 passed, 0 failed(fullnpm run test:control-planealso passed6695 passed, 91 pre-existing skips, 0 failedon identical TS sources at894bfbaba1)ruff check,mypy --follow-imports=silenton typed control-plane owners,scripts/check_rfc_bilingual.py,loopx check(25 files clean): all passedloopx canary premerge --from-git-diff --git-diff-base origin/main --goal-id personal-loopx-maintenance: passed (selected=19 failures=0) includingcontrol-plane-maintainability-ratchet-smoke.py(ok: true,unreviewed_count: 0) and valid Goal CQR receiptcqr_1315f4b55cdb5dd5d5c4(decision: "pass").